package cn.bdqn.homework;

public class Army {
private Weapon[] weapons;
	
	public Army(int number) {
		weapons = new Weapon[number];
	}

	public void addWeapon(Weapon weapon) {
		for(int i = 0; i < weapons.length; i++) {
			if(weapons[i] == null) {
				weapons[i] = weapon;
				break;
			}
		}
		
	}
	
	public void attackAll() {
		for(int i = 0; i < weapons.length; i++) {
			if(weapons[i] != null) {
				weapons[i].attack();
			}
		}
		
	}
	
	public void moveAll() {
		for(int i = 0; i < weapons.length; i++) {
			if(weapons[i] != null) {
				weapons[i].move();
			}
		}
		
	}
	
	


}
